package com.feri.redromance01.controller;

import com.feri.redromance01.entity.Mas;
import com.feri.redromance01.service.intf.MasService;
import com.feri.redromance01.vo.PageBean;
import com.feri.redromance01.vo.R;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 神兽保佑
 * 代码无BUG!
 *
 * @Author: 李南航
 * @date 2022/8/29 14:21
 * @project RedRomance
 * @Description:
 */
@RestController
@RequestMapping("/api/mas/")
public class MasController {
    @Autowired
    private MasService service;
    /* 新增*/
    @PostMapping("save.do")
    public R save(Mas mas){
        System.out.println(mas);
        return service.save(mas);
    }
    //删除
    @GetMapping("delete.do")
    public R delete(@Param("k_id") Integer k_id){
        System.out.println(k_id);
        return service.delete(k_id);
    }
    //修改
    @PostMapping("update.do")
    public R update(Mas mas){
        return service.update(mas);
    }
    //查询-分页-条件查询
    @GetMapping("page.do")
    public PageBean selectPage(String k_package,int page,int limit){
        return service.selectPage(k_package,page,limit);
    }
}
